#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{

    printf("我是一个进程，pid:%d, ppid:%d\n", getpid(), getppid());

    pid_t id = fork();

    printf("我是一个进程(fork)，pid:%d, ppid:%d\n", getpid(), getppid());

    while(1)
    {
        printf("I am a process, pid:%d, ppid:%d\n", getpid(), getppid());
        sleep(1);
    }
    //chdir("/home/ganlin");
    //FILE *fp = fopen("log.txt","w");

    //if(fp == NULL)
    //{
    //    perror("fopen");
    //}
    //fclose(fp);


    //printf("I am a process pid :%d ppid : %d\n", getpid(), getppid());
    //
    //fork();    
    //    
    //printf("I am a process pid :%d ppid : %d\n", getpid(), getppid());
        
    
    //while(1)
    //{
    //    printf("I am a process pid :%d ppid : %d\n", getpid(), getppid());
    //    sleep(1);
    //}

    return 0;
}
